﻿@using PopForums.Controllers
@using PopForums.Extensions;
@using PopForums.Models;
@model List<PrivateMessage>
@{
    ViewBag.Title = PopForums.Resources.PrivateMessages;
    Layout = "~/Areas/PopForums/Views/Shared/PopForumsMaster.cshtml";
}

@section HeaderContent {
	<script type="text/javascript" language="javascript">
		$(function () {
			PopForums.startTimeUpdater();
		});
	</script>
}

<div id="TopBreadcrumb" class="navAbsolute">
	<h1>@PopForums.Resources.PrivateMessages</h1>
	<p>
		^ @Html.ActionLink(PopForums.Resources.Forums, "Index", ForumHomeController.Name, null, null)
		-&gt; @Html.ActionLink(PopForums.Resources.SendPM, "Create")
	</p>
</div>

@Html.PagerLinks("PrivateMessages", "Index", (PagerContext)ViewBag.PagerContext, "pagerLinks", "morePager", "currentPager")

<table class="forumGrid">
	@foreach (var pm in Model)
	{
		<tr>
			<td class="newIndicator">
				<a href="@Url.Action("View", new { id = pm.PMID })">@Html.PMReadIndicator(pm, "/Content/PopForums/")</a>
			</td>
			<td>
				@using(Html.BeginForm("ArchivePM", "PrivateMessages", new { id = pm.PMID })) {
					<input type="submit" value="@PopForums.Resources.Archive" />
				}
			</td>
			<td>@Html.ActionLink(pm.Subject, "View", new { id = pm.PMID })</td>
			<td>@pm.UserNames</td>
			<td><span class="lastPostTime fTime" data-utc="@FormatTime8601(pm.LastPostTime)">@FormatTime(pm.LastPostTime)</span></td>
		</tr>
	}
</table>

<p>@Html.ActionLink(PopForums.Resources.ViewArchivedMessages, "Archive")</p>